<!DOCTYPE html>
<html lang="zh-cn">

<head>
    <meta charset="UTF-8">
    <title>React HandlessUI | 开关</title>
    <script src="./index.tsx" type="module"></script>
    <style>
        .ui-switch {
            position: relative;
            width: 50px;
            height: 30px;
            display: inline-block;
            border-radius: 15px;
            border: 1px solid #dfdfdf;
        }

        .ui-switch::before {
            content: " ";
            background-color: #007aff;
            height: 32px;
            border-radius: 15px;
            position: absolute;
            top: -1px;
            left: -1px;
            transition-property: width;
            transition-duration: 300ms;
        }

        .ui-switch::after {
            content: " ";
            width: 30px;
            height: 30px;
            border-radius: 50%;
            background-color: #fff;
            box-shadow: 0 1px 3px rgba(0, 0, 0, .4);
            position: absolute;
            top: 0;
            transition-property: left;
            transition-duration: 300ms;
        }

        .ui-switch.off {
            background-color: #ffffff;
        }

        .ui-switch.off::before {
            width: 32px;
        }

        .ui-switch.off::after {
            left: 0;
        }

        .ui-switch.on::before {
            width: 52px;
        }

        .ui-switch.on::after {
            left: 20px;
        }
    </style>
</head>

<body>
    <div id="app"></div>
</body>

</html>